<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
        <meta charset="utf-8">
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<meta content="width=device-width, minimum-scale=1,initial-scale=1, maximum-scale=1, user-scalable=1" id="viewport" name="viewport" />
		<meta content="yes" name="apple-mobile-web-app-capable" />
		<meta content="black" name="apple-mobile-web-app-status-bar-style" />
		<meta content="telephone=no" name="format-detection" />
		<link type="text/css" rel="stylesheet" href="../../template/css/com/com.css"/>
		<link type="text/css" rel="stylesheet" href="../../template/css/list/style.css"/>
        <script type="text/javascript" src="../../script/constants.js"></script>
		<script src="../../template/js/jquery.js"></script>
		<script src="../../template/js/com/com.js"></script>
		<script src="../../template/js/com/template.js"></script>
		<script src="../../resource/my.js"></script>
		<script src="../../script/api.js"></script>
            <link rel="stylesheet" href="../../resource/jinsuistyle.css" />
        <script type="text/javascript">
       apiready = function(){
         if(api.systemType == "ios"){
		   document.getElementById("statusBar").style.background = "#298cb4";
		 }
         $api.fixStatusBar( $api.dom('header') );
         var header = $api.byId('jsheader');
         if(api.systemType=='ios'){
     			$api.fixIos7Bar(header);
     		}
//   		else{
//   			$api.fixStatusBar(header);
//   		}

        var _openid = $api.getStorage('openid');
        var header = $api.byId('js-com-header-area');
        $api.fixIos7Bar(header);
   		jQuery.ajax({
	           url:url.zclsurl,
	           type:"post",
	           data:{openid:_openid},
	           dataType: "json",
	           error:function(xhr, textStatus, errorThrown){
	                console.log("服务请求错误,请联系管理员【错误代码："+xhr.status+"】");
	           },
	           success: function (data) {
	        	   showList(data);
	           }
	    	});
   	 }

   	function showList(data){
   	var dd = eval("("+ data.json +")");
	   var html = "";
	   if(dd.length > 0){
		   for(var i=0;i<dd.length;i++){
			   html+= "<div class=\"pxui-area goodlist\" style=\"margin:10px 0;\">"
						+ "<div class=\"pxui-form-info\" style=\"padding:5px 5px 0px 5px;margin:0 5px;line-height: 22px;\">"
						+ "<b>订单号</b>："+ dd[i].id+" <br/><b>订单时间</b>： " + dd[i].xgrq + "<br/><b>收货地址</b>：" + dd[i].dz.replace(new RegExp(',','gm'),'');
						//+ "<b>订单号</b>："+ dd[i].id+" <br/><b>订单时间</b>： " + dd[i].xgrq;
				var p = "";
				var xhs = "";
				for(var j=0;j<dd[i].sps.length;j++){
					xhs += dd[i].sps[j].xh;
					if(j+1 != dd[i].sps.length)
						xhs +=",";
					p +=("<p>"
						+ "<span>" + dd[i].sps[j].mc + "<span style=\"float:right;text-align:right;\">单价：￥" + dd[i].sps[j].price + "</span></span>"
						+ "<label style=\"float:right;\">共" + dd[i].sps[j].amount + " 件商品，合计：￥" + dd[i].sps[j].total + "</label>"
						+ "</p>");
				}
				html+= p;
				//html += "<input type=\"hidden\" id=\"xhs"+ i +"\" value=\"" + xhs + "\"/>";
				html+= "</div>"
						+ "<div style=\"font-weight:bold;width:98%;float:left;text-align:right;\">"
						+ "<input type=\"button\" class=\"pxui-light-button addtocart\" style=\"float:left;padding:5px 10px;margin:0px 0px 10px 10px;\" value=\"查看物流\" onclick=\"ckwl('" + xhs +"')\" />"
						+ "总计：<label class=\"pxui-color-red\">￥"+dd[i].total+"</label> （已支付）"
						+ "</div>"
						+ "</div>";
		   }
	   }else{
		   html = "<div class=\"pxui-area goodlist\"><div style=\"text-align:center;padding: 50px 0;font-size: 16px;\">没有历史订单！<br/>"
			 + "<a href=\"<%=basePath %>wx/mall/main.jsp\">返回首页</a></div></div>";
	   }
	   $("#history_list").html(html);
   	}
        	function ckwl(e){
        	console.log(e);
        		 api.openWin({
				    name: 'flow',
				    url: './flow.html',
				    pageParam: {
				        orderid: e
				    }
				});
        	}

        function closeWin(){
         api.openWin({
			    name: 'main',
			    url: './jscg.html',
			    pageParam: {

			    }
				});
        }

        function goMain(){
          api.closeWin();
        }
        </script>
        <style>
        	.page-title{margin:0px 5px 10px 5px;}
        </style>
  </head>
<body style="background-color: #ffffff">
<header id="statusBar">
  <div id="jsheader">
      <nav id="jsnav">
          <a id="jsleft" tapmode="" onclick="api.closeToWin({name: 'root'});">
              <span>主页</span>
          </a>
          <div id="jsmiddle">
              <strong id="jstitle">金穗采购</strong>
          </div>
          <a id="jsright">
            <span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
          </a>
      </nav>
  </div>
  </header>
	<div class="com-content style-page">
		<div class="com-header-area" id="js-com-header-area">
			<!-- <a href="" class="com-header-logo"
				style="width:100%;color:#FFFFFF;text-align:center;font-size:20px;">金穗采购</a> -->
				<img src="../../image/jscg0.png" style="width:100%;"/>
				<ul class="menu_ul">
					<a href="jscg.html" class="selected"><li>首  页</li></a>
					<a href="history.html"><li>历 史 订 单</li></a>
					<a href="bill.html"><li>购 物 框</li></a>
				</ul>
			<dfn></dfn>
			<div class="clear"></div>
		</div>  
		<div class="com-content-area" id="js-com-content-area">
			<!-- <div class="pxui-tab pxui-tab-nav pxui-tab-no-top">
				<a href="main.html"><i></i>首 页<span></span></a>
				<a href="history.html" class="selected"><i></i>历史订单<span></span></a>
				<a href="bill.html"><i></i>购物筐<span></span></a>
			</div> -->
			
			
			<div class="page-title">
					<a href="#" onclick="closeWin();" class="return">返 回</a>历史订单
			</div>
			<div class="page-role cart-page cart-index-page" id="history_list" style="min-height:55%;margin:0px 5px 0px 5px;">

					<div class="pxui-area goodlist">
						<div style="text-align:center;padding: 50px 0;font-size: 16px;">
							数据加载中，清稍后...
						</div>
					</div>

		</div>
	</div>
		<!-- 公共底部，必须引用 -->
		<!-- <div class="com-footer-area" id="js-com-footer-area">
			<div class="com-footer-nav">
				<a href="main.html">首 页</a>
				<a href="history.html">历史订单</a>
				<a href="bill.html">购物筐</a>
			</div>
			<div class="com-footer">
				 © 2012-2018 四川航天金穗高技术有限公司 <br /> All Rights Reserved
				联系电话：028-66778822
			</div>
		</div> -->
		<div class="com-footer-area footer" id="js-com-footer" style="width:100%;">
				<img src="../../image/db.png" style="width:100%;"/>
			</div>
</div>

</body>
</html>
